using System;
using System.Collections.Generic;
using System.Text;
using System.ServiceModel;
using System.Windows.Forms;

namespace Watchdog.ServiceHost {
    class Program {

        static log4net.ILog Log;
        static void Main ( string[] args ) {
            AppDomain.CurrentDomain.UnhandledException += new UnhandledExceptionEventHandler (CurrentDomain_UnhandledException);
            
            Log = log4net.LogManager.GetLogger ("servicehost.Logging");
            System.ServiceModel.ServiceHost host = new System.ServiceModel.ServiceHost ( typeof ( Watchdog.Wcf.WatchdogDataService ) );
            host.Open ();
            Log.Debug ("Starting ServerTeam Data service");
            System.ServiceModel.ServiceHost host2 = new System.ServiceModel.ServiceHost ( typeof ( ServerTeam.Wcf.ServerTeamDataService ) );
            host2.Open ();
            Log.Debug ("Starting Watchdog Data service");

            Console.WriteLine ( "Service is active" );
            Console.ReadLine ();
            Log.Debug ("Stopping ServerTeam Data service");
            host.Close ();
            Log.Debug ("Stopping Watchdog Data service");
            host2.Close ();
        }

        static void CurrentDomain_UnhandledException ( object sender, UnhandledExceptionEventArgs e ) {
            Log.Debug ("An error occured", (System.Exception)e.ExceptionObject);
        }
    }
}
